@extends('admin.common.web')

@section('title','添加')

@section('content')
<!-- Page Content -->
    <!-- Page Breadcrumb -->
    <div class="page-breadcrumbs">
        <ul class="breadcrumb">
            <li>
                <a href="#">系统</a>
            </li>
            <li>
                <a href="#">文章管理</a>
            </li>
            <li class="active">添加文章</li>
        </ul>
    </div>
    <!-- /Page Breadcrumb -->
    <!-- Page Body -->
    <div class="page-body">
        <div id="horizontal-form">
            @include('admin.common.msg')
            @include('admin.common.error')
            <form class="form-horizontal" action="{{ route('admin.article.store') }}" enctype="multipart/form-data" method="post">
                <div class="tabbable">
                    <ul class="nav nav-tabs" id="myTab">
                        <li class="active">
                            <a data-toggle="tab" href="#home">
                                基本信息
                            </a>
                        </li>

                        <li class="tab-red">
                            <a data-toggle="tab" href="#profile">
                                文章标签
                            </a>
                        </li>
                    </ul>

                    <div class="tab-content">
                        <div id="home" class="tab-pane in active">

                            @csrf
                            <div class="form-group">
                                <label for="group_id" class="col-sm-2 control-label no-padding-right">文章分类</label>
                                <div class="col-sm-6">
                                    <select name="category_id" style="width: 100%;">
                                        @foreach($categoryList as $k => $v)
                                            <option value="{{ $v['id'] }}"><?php echo str_repeat('----',$v['level'])?>{{ $v['category_name'] }}</option>
                                        @endforeach
                                    </select>
                                </div>
                            </div>

                            <div class="form-group">
                                <label for="username" class="col-sm-2 control-label no-padding-right">标题</label>
                                <div class="col-sm-6">
                                    <input class="form-control" value="{{ old('title','测试' . mt_rand(0,1999)) }}" name="title" required type="text">
                                </div>
                                @if($errors->has('title'))
                                    <p class="help-block col-sm-4 blue">{{ $errors->first('title') }}</p>
                                @else
                                    <p class="help-block col-sm-4 red">* 必填</p>
                                @endif
                            </div>

                            <div class="form-group">
                                <label for="username" class="col-sm-2 control-label no-padding-right">作者</label>
                                <div class="col-sm-6">
                                    <input class="form-control" value="{{ old('author','admin') }}" name="author" required type="text">
                                </div>
                                @if($errors->has('author'))
                                    <p class="help-block col-sm-4 blue">{{ $errors->first('author') }}</p>
                                @else
                                    <p class="help-block col-sm-4 red">* 必填</p>
                                @endif
                            </div>

                            <div class="form-group">
                                <label for="username" class="col-sm-2 control-label no-padding-right">图片</label>
                                <div class="col-sm-6">
                                    <input class="form-control" value="{{ old('thumb') }}" name="thumb" type="file">
                                </div>
                                @if($errors->has('thumb'))
                                    <p class="help-block col-sm-4 blue">{{ $errors->first('thumb') }}</p>
                                @else
                                    <p class="help-block col-sm-4 red">* 必填</p>
                                @endif
                            </div>

                            <div class="form-group">
                                <label for="username" class="col-sm-2 control-label no-padding-right">排序</label>
                                <div class="col-sm-6">
                                    <input class="form-control" value="{{ old('sort','0') }}" name="sort" required type="text">
                                </div>
                                @if($errors->has('sort'))
                                    <p class="help-block col-sm-4 blue">{{ $errors->first('sort') }}</p>
                                @else
                                    <p class="help-block col-sm-4 red">* 必填</p>
                                @endif
                            </div>

                            <div class="form-group">
                                <label for="is_show" class="col-sm-2 control-label no-padding-right">是否显示</label>
                                <div class="col-xs-4">
                                    <label>
                                        <input class="checkbox-slider toggle colored-blue" checked value="1" name="is_show" type="checkbox">
                                        <span class="text"></span>
                                    </label>
                                </div>
                            </div>

                            <div class="form-group">
                                <label for="is_show" class="col-sm-2 control-label no-padding-right">文章内容</label>
                                <div id="test-editormd">
                                    <textarea name="content" style="display:none;">Hello</textarea>
                                </div>
                            </div>


                        </div>

                        <div id="profile" class="tab-pane">
                            <div class="form-group">
                                <label for="is_show" class="col-sm-2 control-label no-padding-right">文章标签</label>
                                <div class="col-xs-4">
                                    <label>
                                        <textarea name="tags" cols="60" rows="5" placeholder="多个标签用英文 , 号隔开"></textarea>
                                    </label>
                                </div>
                            </div>
                        </div>

                        <div class="form-group">
                            <div class="col-sm-offset-2 col-sm-10">
                                <button type="submit" class="btn btn-info">保存信息</button>
                                <a href="JavaScript:window.history.go(-1);" class="btn btn-default">返回</a>
                            </div>
                        </div>
                    </div>

                </div>

                <div class="horizontal-space"></div>

            </form>
        </div>

        {{--<div class="row">
            <div class="col-lg-12 col-sm-12 col-xs-12">
                <div class="widget">
                    <div class="widget-header bordered-bottom bordered-blue">
                        <span class="widget-caption">新增文章</span>
                    </div>
                    <div class="widget-body">

                    </div>
                </div>
            </div>
        </div>--}}


    </div>
<div id="profile" class="tab-pane">
    <div id="test-editormd">
        <textarea name="test-editormd" style="display:none;"></textarea>
    </div>
</div>
    <!-- /Page Body -->
@endsection
@include('markdown::encode',['editors'=>['test-editormd']])
